<?php

namespace JsonLowCode\UI;

use JsonLowCode\Schema;
use JsonLowCode\Traits\Events\HasOnUpdateValue;
use JsonLowCode\Traits\Props\HasValue;

/**
 * SfcApi 远程Sfc组件
 * @method static SfcApi make(string $api = null) SfcApi 远程Sfc组件
 */
class SfcApi extends Schema
{
    protected string $componentName = "SfcApi";

    use HasValue;

    use HasOnUpdateValue;

    public function __construct(string $api = null)
    {
        parent::__construct();
        $api!=null && $this->api($api);
    }

    /**
     * 远程sfc路径
     * @param string $api
     * @return $this
     */
    public function api(string $api): static
    {
        return $this->prop("api",rtrim($api,".vue").".vue");
    }
}
